#include "edfsignalsource.h"
#include "edfmodel.h"
#include <iostream>

namespace biosignal
{
namespace edf
{


EDFSourceSignal::EDFSourceSignal(const EDFModel* edf_model, string label) :
	SourceSignal(label), m_edf_model(edf_model)
{

}

void EDFSourceSignal::init()
{
	//    std::cout << "signal \"" << label << "\" initialized  sizeof(int) : " << sizeof(int) << std::endl;
	m_scale = (m_physical_maximum - m_physical_minimum) / (m_digital_maximum
			- m_digital_minimum);
	m_sample_frequency= m_nr_samples_in_data_record/m_edf_model->datarecord_duration();
}

double EDFSourceSignal::physical_minimum() const
{
return m_physical_minimum;
}
double EDFSourceSignal::physical_maximum() const
{
return m_physical_maximum;
}
long EDFSourceSignal::digital_minimum() const
{
return m_digital_minimum;
}
long EDFSourceSignal::digital_maximum() const
{
return m_digital_maximum;
}
std::string EDFSourceSignal::prefiltering() const
{
return m_prefiltering;
}
int EDFSourceSignal::nr_samples_in_data_record() const
{
return m_nr_samples_in_data_record;
}

double EDFSourceSignal::value( sample_type raw_num ) const
{
return raw_num * m_scale;
}

}
}
